<?php
namespace app\web\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class GroupOrder extends Validate
{
    //定义验证规则
    protected $rule = [
        'goods_id|商品id'  => 'require|number',
        'sku_id|属性id'  => 'require|number',
        'goods_num|商品数量'  => 'require|number',
        'address_id|地址id'  => 'require',
        'group_id|团购ID'  => 'require|number',
    ];
    //定义验证提示
    protected $message = [
        'goods_id.require' => '商品信息必须填写',
        'goods_id.number' => '商品信息格式不正确',
        'sku_id.require' => '属性信息必须填写',
        'sku_id.number' => '属性信息格式不正确',
        'goods_num.require' => '商品数量必须填写',
        'goods_num.number' => '商品数量格式不正确',
        'address_id.require' => '地址信息必须填写',
        'group_id.require' => '团购信息必须填写',
        'group_id.number' => '团购信息格式不正确',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['goods_id','sku_id','goods_num','address_id','add'],
    ];
}
